package com.dingreading.cloud.admin.service;

import com.dingreading.cloud.admin.entity.WhStockOutGoods;
import com.dingreading.cloud.common.util.PageUtil;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 服务层。
 *
 * @author Administrator
 * @since 2023-11-22
 */
public interface WhStockOutGoodsService extends IService<WhStockOutGoods> {

    Page<WhStockOutGoods> pageList(PageUtil pageUtil, String keyword, Integer status, Integer realStatus, Integer stockOutMethod, String beginDate, String endDate);

    List<WhStockOutGoods> getByOrderCodeV2(String orderCode, Integer stockOutMethod, List<Integer> status);

    List<WhStockOutGoods> getByOutCode(String outCode);

    boolean cancel(String outCode, String staffUid, String staffName);

    int dropByOutCode(String outCode);

    int dropByOutCodeAndId(String outCode, Long id);

    // 按商品订单号获取出库商品记录
    List<WhStockOutGoods> getOutGoodsListV2(List<String> orderCode, Integer stockOutMethod);

    WhStockOutGoods getByOutCodeAndId(String outCode, Long id);

    boolean setRefund(String outCode, Long id, String staffUid, String staffName, String refundRemark, Date time);

    long getDuplicateShopCartId(String outCode, Long shopCartId);

    // 删除保存中的出库商品详情
    int dropSaveOutGoods(String orderCode);

    // 获取商品的出库数量
    Map<Long, Integer> getSendNum(List<Long> goodsTypeIds);

    // 按日期获取商品的出库数量
    Map<Long, List<WhStockOutGoods>> listByGoodsTypeIdAndAddTimeBetween(List<Long> goodsTypeIds, String beginDate, String endDate);

    List<WhStockOutGoods> listByOrderCodesAndStatus(List<String> codeList, Integer status);

    // 获取购物车商品的出库数量
    Map<Long, Integer> getShopCartOutNum(String orderCode, Integer status, Integer stockOutMethod);

    List<WhStockOutGoods> listByOutCodes(List<String> outCodes);

    Map<Long, Double> lastWetAvgPriceByGoodsTypeIds(String beginDate, String endDate, List<Long> goodsTypeIds);
}
